package org.mybatis.generator.my.bean;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Optional;

@Data
@Accessors(chain = true)
public class ClazzField {

    private String fieldName;

    private String fieldType;

    private String fullFieldType;

    private Optional<String> fieldComment;

    private String columnName;

    private String getMethodName;

    private String setMethodName;

    private boolean nullable;

    public String getFieldComment() {
        return fieldComment.orElse(this.getFieldName());
    }

    @Override
    public String toString() {
        return "ClazzField{" +
                "fieldName='" + fieldName + '\'' +
                ", fieldType='" + fieldType + '\'' +
                ", fullFieldType='" + fullFieldType + '\'' +
                ", fieldComment='" + fieldComment + '\'' +
                ", columnName='" + columnName + '\'' +
                ", getMethodName='" + getMethodName + '\'' +
                ", setMethodName='" + setMethodName + '\'' +
                '}';
    }
}
